package org.scauinfo.fpos.vo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Saleorder entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "saleorder", catalog = "db_fpos")
public class Saleorder implements java.io.Serializable {

	// Fields

	private Integer id;
	private Member member;
	private User user;
	private Tableplate tableplate;
	private String saleorderId;
	private Double realIncome;
	private Timestamp createdDatetime;
	private Integer state;
	private String description;
	private Set<Saleorderitem> saleorderitems = new HashSet<Saleorderitem>(0);

	// Constructors

	/** default constructor */
	public Saleorder() {
	}

	/** minimal constructor */
	public Saleorder(Member member, User user, String saleorderId,
			Timestamp createdDatetime, Integer state) {
		this.member = member;
		this.user = user;
		this.saleorderId = saleorderId;
		this.createdDatetime = createdDatetime;
		this.state = state;
	}

	/** full constructor */
	public Saleorder(Member member, User user, Tableplate tableplate,
			String saleorderId, Double realIncome, Timestamp createdDatetime,
			Integer state, String description, Set<Saleorderitem> saleorderitems) {
		this.member = member;
		this.user = user;
		this.tableplate = tableplate;
		this.saleorderId = saleorderId;
		this.realIncome = realIncome;
		this.createdDatetime = createdDatetime;
		this.state = state;
		this.description = description;
		this.saleorderitems = saleorderitems;
	}

	/**
	 * @param member2
	 * @param user2
	 */
	public Saleorder(Member member2, User user2) {
		this.user=user2;
		this.member=member2;
	}
	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "member_id", referencedColumnName = "member_id", nullable = false)
	public Member getMember() {
		return this.member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "table_plate" , referencedColumnName = "table_plate")
	public Tableplate getTableplate() {
		return this.tableplate;
	}

	public void setTableplate(Tableplate tableplate) {
		this.tableplate = tableplate;
	}

	@Column(name = "saleorder_id", nullable = false)
	public String getSaleorderId() {
		return this.saleorderId;
	}

	public void setSaleorderId(String saleorderId) {
		this.saleorderId = saleorderId;
	}

	@Column(name = "real_income", precision = 22, scale = 0)
	public Double getRealIncome() {
		return this.realIncome;
	}

	public void setRealIncome(Double realIncome) {
		this.realIncome = realIncome;
	}

	@Column(name = "created_datetime", nullable = false, length = 19)
	public Timestamp getCreatedDatetime() {
		return this.createdDatetime;
	}

	public void setCreatedDatetime(Timestamp createdDatetime) {
		this.createdDatetime = createdDatetime;
	}

	@Column(name = "state", nullable = false)
	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Column(name = "description", length = 65535)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "saleorder")
	public Set<Saleorderitem> getSaleorderitems() {
		return this.saleorderitems;
	}

	public void setSaleorderitems(Set<Saleorderitem> saleorderitems) {
		this.saleorderitems = saleorderitems;
	}

}